package hn.cch.grammar.security;

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * MD5
 * 消息摘要算法(第五版)
 * Message Digest Algorithm
 */
public class Md5Util {

    private static String algorithm = "MD5";



    public static void main(String[] args) {
        String data = "qwertyuiopasdfghjklzxcvbnm";

        byte[] info = new byte[0];
        try {
            info = MessageDigest.getInstance(algorithm)
                    .digest(data.getBytes(StandardCharsets.UTF_8));
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        System.out.println(HexUtil.toHex(info));

    }


}
